package com.zxc.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 试卷表(Exam)实体类
 *
 * @author makejava
 * @since 2019-05-01 11:38:58
 */
public class OnlineExam extends BaseEntity{
    private static final long serialVersionUID = 922283745093904434L;

    private Integer examId;
    //试卷名
    private String examName;
    //考试开始时间
    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
    private Date examStartDate;
    //考试持续的时间，单位为分钟
    private Long examLastTime;
    //批阅者的id
    private Integer reviewerId;
    //试卷的总分
    private Double score;

    //学生考试总分
    private Double totalScore;

    /**
     * 试题的id
     */
    private Integer[] ids;
    /**
     * 试题的id变成str
     */
    private String idsStr;
    /**
     * 选择参加考试的学生的id
     */
    private Integer[] studentIds;

    /**
     * 当前考试是否参加
     */
    private Boolean accessed;

    /**
     * 当前试卷的学生的id
     */
    private Integer studentId;
    /**
     * 学生的姓名
     */
    private String studentName;
    /**
     * 是否已经批阅
     */
    private String reading;

    private String subname;

    private String subid;

    public String formateTime(Date date) {
        SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return df.format(date);

    }

    /**
     * 传入日期是否小于等于当前日期
     * @param date
     * @return
     */
    public Boolean isLessThanCurrent(Date date) {
        Date curent = new Date();
        int curennt = date.compareTo(curent);
        if (curennt == -1 || curennt == 0) {
            return true;
        } else {
            return false;
        }
    }


    public void setSubname(String subname) {
        this.subname = subname;
    }

    public String getSubname() {
        return subname;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public Integer getExamId() {
        return examId;
    }

    public void setExamId(Integer examId) {
        this.examId = examId;
    }

    public String getExamName() {
        return examName;
    }

    public void setExamName(String examName) {
        this.examName = examName;
    }

    public Date getExamStartDate() {
        return examStartDate;
    }

    public void setExamStartDate(Date examStartDate) {
        this.examStartDate = examStartDate;
    }

    public Long getExamLastTime() {
        return examLastTime;
    }

    public void setExamLastTime(Long examLastTime) {
        this.examLastTime = examLastTime;
    }

    public Integer getReviewerId() {
        return reviewerId;
    }

    public void setReviewerId(Integer reviewerId) {
        this.reviewerId = reviewerId;
    }

    public Double getScore() {
        return score;
    }

    public void setScore(Double score) {
        this.score = score;
    }

    public Double getTotalScore() {
        return totalScore;
    }

    public void setTotalScore(Double totalScore) {
        this.totalScore = totalScore;
    }

    public Integer[] getIds() {
        return ids;
    }

    public void setIds(Integer[] ids) {
        this.ids = ids;
    }

    public String getIdsStr() {
        return idsStr;
    }

    public void setIdsStr(String idsStr) {
        this.idsStr = idsStr;
    }

    public Integer[] getStudentIds() {
        return studentIds;
    }

    public void setStudentIds(Integer[] studentIds) {
        this.studentIds = studentIds;
    }

    public Boolean getAccessed() {
        return accessed;
    }

    public void setAccessed(Boolean accessed) {
        this.accessed = accessed;
    }

    public Integer getStudentId() {
        return studentId;
    }

    public void setStudentId(Integer studentId) {
        this.studentId = studentId;
    }

    public String getStudentName() {
        return studentName;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    public String getReading() {
        return reading;
    }

    public void setReading(String reading) {
        this.reading = reading;
    }

    public String getSubid() {
        return subid;
    }

    public void setSubid(String subid) {
        this.subid = subid;
    }
}